package Thread;

/**
 * interrupt 的用法
 */

public class Demo32 {
    private static Object locker = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            synchronized (locker){
                System.out.println("wait 之前");
                try {
                    locker.wait();
                    System.out.println("wait 之后");
                } catch (InterruptedException e) {

                    throw new RuntimeException(e);
                }
            }
        });

        t.start();

        Thread.sleep(1000);

        t.interrupt();

    }
}
